<?php
/* --- 若无特别需求,请勿修改此文件,谢谢 --- */
include(dirname(__FILE__) . '/inc.php');
define('IN_FRAME', 'YES');

$_m_ = '';
$_c_ = 'index';
$_a_ = 'index';

if (USE_PATH_INFO && is_array($_SERVER) && isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO'])) {
    $_strPathInfo_ = $_SERVER['PATH_INFO'];
    if (defined('URL_EXT') && '' != URL_EXT) {
        $_strPathInfo_ = str_replace(URL_EXT, '', $_strPathInfo_);
    }
    $_arrPathInfo_ = explode('/', substr($_strPathInfo_, 1));
    $_cntPathInfo_ = count($_arrPathInfo_);
    if ($_cntPathInfo_ == 2) {
        !empty($_arrPathInfo_[0]) && $_c_ = $_arrPathInfo_[0];
        !empty($_arrPathInfo_[1]) && $_a_ = $_arrPathInfo_[1];
    } elseif ($_cntPathInfo_ == 3) {
        !empty($_arrPathInfo_[0]) && $_m_ = $_arrPathInfo_[0];
        !empty($_arrPathInfo_[1]) && $_c_ = $_arrPathInfo_[1];
        !empty($_arrPathInfo_[2]) && $_a_ = $_arrPathInfo_[2];
    }
} elseif (is_array($_GET) && isset($_GET['c']) && !empty($_GET['c'])) {
    $_c_ = $_GET['c'];
    if (isset($_GET['a']) && !empty($_GET['a'])) {
        $_a_ = $_GET['a'];
    }
    if (isset($_GET['m']) && !empty($_GET['m'])) {
        $_m_ = $_GET['m'];
    }
}

$_blnOk_ = false;
$_strCtrlName_ = 'c_' . $_c_;
$_blnM_ = !empty($_m_);
if ($_blnM_) {
    $_strPath_ = CTRLS_PATH . '/' . $_m_ . '/' . $_strCtrlName_ . '.class.php';
    if (file_exists($_strPath_)) {
        require($_strPath_);
    }
}
if (class_exists($_strCtrlName_, !$_blnM_)) {
    $_objCtrl_ = new $_strCtrlName_;
    if (is_callable(array($_objCtrl_, $_a_))) {
        define('_ROUTE_M_', $_m_);
        define('_ROUTE_C_', $_c_);
        define('_ROUTE_A_', $_a_);
        call_user_func(array($_objCtrl_, $_a_));
        $_blnOk_ = true;
    }
}
if (!$_blnOk_) {
    Helper::jsLoadTo('/', '页面不存在!');
}